//
//  HTSubscribeReducer.swift
//  MagaCore
//
//  Created by MrMessy on 2023/5/18.
//

import Foundation
import ReSwift

struct HTSubscribeReducer {
  static var var_reducer: Reducer<HTSubscribeState> {
    return { action, state in
      var state = state ?? HTSubscribeState()
      guard let action = action as? HTEnumSubscribeAction else {
        return state
      }
      switch action {
      case .htEnumProductsInfo(var_subscribes: let var_subscribes):
        state.var_subscribes = var_subscribes
        return state
      case .htEnumSelSub(var_selSub: let var_selSub):
        state.var_selSubscribe = var_selSub
        return state
      case .htEnumCurSub(var_curSub: let var_curSub):
        state.var_curSubscribe = var_curSub
        return state
      case .htEnumIntroductorySub(var_introductorySub: let var_introductorySub):
        state.var_introductorySubscribe = var_introductorySub
        return state
      case .htEnumSetPurchasingSubscribe(var_purchasingSub: let var_purchasingSub):
        state.var_purchasingSubscribe = var_purchasingSub
        return state
      }
    }
  }
}
